"and" is not the same like && , also, "or" is not same like ||
&& is higher priority than "and" , also, || is higher priority than "or".
For example:
is not the same like:
the first thing is:
(a and b) or c
the second:
a and (b or c)
Because || has got a higher priority than and, but less than && .
Using always [ && and || ] or [ AND and OR ] would be okay, but than you should at least respect the following:
the first code will set $a to the result of the comparison $b with $c, both have to be true, while the second code line will set $a like $b and THAN - after that - compare the success of this with the value of $c .
&& is higher priority than "and" , also, || is higher priority than "or".
For example:
PHP Code:
$a && $b || $c;
PHP Code:
$a and $b || $c;
(a and b) or c
the second:
a and (b or c)
Because || has got a higher priority than and, but less than && .
Using always [ && and || ] or [ AND and OR ] would be okay, but than you should at least respect the following:
PHP Code:
$a = $b && $c;
$a = $b and $c;
Comment